import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CustomClassificationVO, CustomClassificationForm, CustomClassificationQuery } from '@/api/merchants/customClassification/types';

/**
 * 查询特色分类列表
 * @param query
 * @returns {*}
 */

export const listCustomClassification = (query?: CustomClassificationQuery): AxiosPromise<CustomClassificationVO[]> => {
  return request({
    url: '/merchants/customClassification/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询特色分类下拉列表
 * @returns {*}
 */
export const listCustomClassificationOption = (query:any): AxiosPromise<CustomClassificationVO[]> => {
  return request({
    url: '/merchants/customClassification/option',
    method: 'get',
    params: query
  });
};

/**
 * 查询特色分类详细
 * @param id
 */
export const getCustomClassification = (id: string | number): AxiosPromise<CustomClassificationVO> => {
  return request({
    url: '/merchants/customClassification/' + id,
    method: 'get'
  });
};

/**
 * 新增特色分类
 * @param data
 */
export const addCustomClassification = (data: CustomClassificationForm) => {
  return request({
    url: '/merchants/customClassification',
    method: 'post',
    data: data
  });
};

/**
 * 修改特色分类
 * @param data
 */
export const updateCustomClassification = (data: CustomClassificationForm) => {
  return request({
    url: '/merchants/customClassification',
    method: 'put',
    data: data
  });
};

/**
 * 删除特色分类
 * @param id
 */
export const delCustomClassification = (id: string | number | Array<string | number>) => {
  return request({
    url: '/merchants/customClassification/' + id,
    method: 'delete'
  });
};
